﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.ComponentModel;

namespace ProbaWeb
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string str1 = "ala";
                string str2 = "bala";
                string str3 = "asd";

                Source s = new Source();
                List<string> list = new List<string>() { str1, str2, str3 };
                s.MySource = list;
                s.Name = "Name1";
                s.WayStations = "1,2,4,5,8,7,9";
                Source s1 = new Source();
                List<string> l2 = new List<string>() { "gf", "hgf", "gfh", "hg", "gh" };
                s1.MySource = l2;
                s1.Name = "Name2";
                s1.WayStations = "9,8,5,4,88,5,7,8";

                List<Source> sList = new List<Source>() { s, s1 };

                outer.DataSource = sList;
                outer.ItemDataBound += new RepeaterItemEventHandler(outer_ItemDataBound);
                outer.DataBind();
            }
        }

        void outer_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            
            List<string> ll=((List<Source>)((sender as Repeater).DataSource))[0].MySource;
            Repeater inner = (Repeater)e.Item.FindControl("inner");
            Button button = (Button)e.Item.FindControl("button");
            inner.DataSource = DataBinder.Eval(e.Item.DataItem,"MySource");
            inner.DataBind();
        }

        protected void button_Command(object sender, CommandEventArgs e)
        {
            string str=e.CommandArgument.ToString();
            lbl.Text = str;
        }
    }
}
